const { defineConfig } = require('@vue/cli-service')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

module.exports = defineConfig({
  publicPath: '/',
  // 设置网站标题
  chainWebpack: config => {
    config.plugin('html').tap(args => {
      args[0].title = '风云精品游戏'
      return args
    })
  },
  devServer: {
    proxy: {
      '/api': {
        target: 'http://120.26.104.163:8168',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    },
    historyApiFallback: {
      rewrites: [
        { from: /.*/, to: '/index.html' }
      ]
    },
    hot: true,
    open: true
  },
  transpileDependencies: true,
  configureWebpack: {
    plugins: [
      new MiniCssExtractPlugin()
    ]
  }
})
